//
//  ZZItemButton.m
//  ZuZuBao
//
//  Created by Felix on 2024/4/9.
//

#import "ZZItemButton.h"

@interface ZZItemButton()

@property (nonatomic, strong) UIImageView * imgView;
@property (nonatomic, strong) UILabel * itemlabel;

@end

@implementation ZZItemButton

-(instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.imgView = [[UIImageView alloc] init];
        [self addSubview:self.imgView];
        
        self.itemlabel = [[UILabel alloc] init];
        self.itemlabel.textColor = k666Color;
        self.itemlabel.font = [UIFont systemFontOfSize:14];
        self.itemlabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.itemlabel];
    }
    return self;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    self.imgView.frame = CGRectMake(self.frame.size.width / 2 - 18, 0, 36, 36);
    self.itemlabel.frame = CGRectMake(0, CGRectGetMaxY(self.imgView.frame), self.frame.size.width, 25);
}

-(void)setButtonImage:(NSString *)image text:(NSString *)text {
    self.imgView.image = [UIImage imageNamed:image];
    self.itemlabel.text = text;
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
